package IO;

import java.io.FileInputStream;
import java.io.FileOutputStream;

public class FileStreamBuffered2Demo {
    public static void main(String[] args) {
        FileInputStream fis = null;
        FileOutputStream fos = null;
        try{
            fis = new FileInputStream("d:/a.jpg");
            fos = new FileOutputStream("d:/new3.jpg");
            byte[] buff = new byte[fis.available()];
            fis.read(buff   );
            fos.write(buff);
            fos.flush();
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            try{
                if(fis != null){
                    fis.close();
                }
                if(fos != null){
                    fos.close();
                }
            }catch (Exception e){
                e.printStackTrace();
            }
        }
    }
}
